﻿<!--- ==================================================
NAME:	crt_shipto_address.cfm
DESC:	File used to create a shipping address.
=================================================== --->
<cfsetting enablecfoutputonly="yes">

<!--- default data --->
<cfparam name="arguments.system" type="any" default="">
<cfparam name="arguments.soldto_acct" type="any" default="">
<cfparam name="arguments.company_name" type="any" default="">
<cfparam name="arguments.address_1" type="any" default="">
<cfparam name="arguments.address_2" type="any" default="">
<cfparam name="arguments.city" type="any" default="">
<cfparam name="arguments.state" type="any" default="">
<cfparam name="arguments.zip" type="any" default="">
<cfparam name="arguments.geo_code" type="any" default="">
<cfparam name="arguments.country" type="any" default="">

<cfif NOT Len(Trim(arguments.company_name))>
	<cfset arguments.company_name = session.company_name>
</cfif>

<!--- clean data --->
<cfset arguments.company_name="#application.string_validation.replace_and(arguments.company_name)#">
<cfset arguments.address_1="#application.string_validation.replace_and(arguments.address_1)#">
<cfset arguments.address_2="#application.string_validation.replace_and(arguments.address_2)#">
<cfset arguments.city="#application.string_validation.replace_and(arguments.city)#">
<cfset arguments.state="#application.string_validation.replace_and(arguments.state)#">


<!--- build xml statement --->
<cfscript>
xi_namespace='#trim(application.xi_namespace)#:CUSTOMER:CreateShipToAddress';
xi_interface='CreateShipToAdd_OB';
xml = '<xtiinput>
	<inputheader>
		<actionset>
			<action>crt_shipto_address</action> 
		</actionset>
	</inputheader>
	<inputdata>
	<system>#variables.system#</system> 
		<customer>
			<soldto_acct>#arguments.soldto_acct#</soldto_acct> 
			<shipto>
				<company_name>#arguments.company_name#</company_name> 
				<address_1>#arguments.address_1#</address_1> 
				<address_2>#arguments.address_2#</address_2> 
				<city>#arguments.city#</city> 
				<state>#arguments.state#</state> 
				<zip>#arguments.zip#</zip> 
				<geo_code>#arguments.geo_code#</geo_code> 
				<country>#arguments.country#</country> 
			</shipto>
		</customer>
	</inputdata>
</xtiinput>';
</cfscript>